<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #hello{text-align: center}
    </style>
</head>
<body>
<h1>
    <p id="hello">
        欢迎新用户加入！
    </p>
</h1>
<div id="register">
    <form action="index.php" method="get">
<!--        如何自动生成用户id-->
        用户名：<input type="text" name="set_username" id="set_username">
        密码：<input type="password" name="set_password" id="set_password">
        电话号码：<input type="text" maxlength="11" name="set_phone_number" id="set_phone_number">
        性别：<select name="set_gender" id="set_gender">
            <option value="男">男</option>
            <option value="女">女</option>
        </select>
        <input type="submit" value="提交">
    </form>
</div>
</body>
</html>
<?php
    $set_user_id=rand(10000000,99999999);
//    echo $set_user_id;
    @$set_username=$_REQUEST['set_username'];
    @$set_password=$_REQUEST['set_password'];
    @$set_phone_number=$_REQUEST['set_phone_number'];
    @$set_gender=$_REQUEST['set_gender'];
    $conn=mysqli_connect('127.0.0.1','root','123456','tpp');
    $sql_txt="insert into tpp_user_info (user_id,username,phone_number,sex,user_rank,user_exp,password) values ($set_user_id,'$set_username','$set_phone_number','$set_gender',1,0,'$set_password')";
    $result=mysqli_query($conn,$sql_txt);
    echo "<br>";
    @$info=mysqli_fetch_array($result);
//    var_dump($info);
    echo "<br>";
?>
<!--参考 https://bbs.zkaq.cn/hw/11.html ; https://www.cnblogs.com/heyangblog/p/7624645.html-->